<?
	function ch_uml($del_uml) {
		$del_uml = preg_replace("=&auml;=", "ä", $del_uml); // Umlaute und ß
		$del_uml = preg_replace("=&ouml;=", "ö", $del_uml);
		$del_uml = preg_replace("=&uuml;=", "ü", $del_uml);
		$del_uml = preg_replace("=&Auml;=", "Ä", $del_uml);
		$del_uml = preg_replace("=&Ouml;=", "Ö", $del_uml);
		$del_uml = preg_replace("=&Uuml;=", "Ü", $del_uml);
		$del_uml = preg_replace("=&szlig;=", "ß", $del_uml);
	return ($del_uml);
	} // end func


	function viewtree($dir, $file) {
	  
	  $noTitle = 0;
	  $noDesc = 0;
	
	  $fh = opendir($dir);
	  echo "<ul class=\"fileTree\">\n";
	  while($entry = readdir($fh)) {
		if($entry == ".." || $entry == ".")
		  continue;
		//if(is_dir($dir . $entry))
		 //viewtree($dir . $entry . "/");
		else {
			  if(stripos( $entry , ".php" ) !== FALSE && !stripos( $entry , ".LCK" ) !== FALSE){
			  
			  
				  $str = join('', file($dir.$entry));	
				  //$str = ch_uml($str);
				  
				  if (!preg_match("=\<\!\-\-.no_search.\-\-\>=siU", $str)) {
				  
					  preg_match("=<title>(.*)</title>=siU", $str, $title);
					  preg_match('=<meta.*name\="description".*content\="(.*)".*>=siU',$str,$descr);
					
					  if (empty($title[1]))		// Title der Seite auslesen
					  $title[1] = "no title";
		
					  if (empty($descr[1]))		// Description der Seite auslesen
					  $descr[1] = "no description";
				
					  echo "<li class=\"".$dir.$entry."\"";
					  if($file == $dir.$entry) echo 'id="lastEdit" ';
					  echo "><a ";
					  if($file == $dir.$entry) echo 'class="lastEdit" ';

					  
					  echo "href=\"".$dir.$entry."\">".$dir.$entry."</a><p class=\"title";
					  if($title[1] == "no title") {echo " no"; $noTitle++; }
					  echo "\">".$title[1]."</p><p class=\"desc";
					  if($descr[1] == "no description") {echo " no"; $noDesc++; }
					  echo "\">".$descr[1]."</p></li>\n";
				   }
			  }
		  }
	  }
	  echo "</ul>\n";
	  closedir($fh);
	  
	  echo "<p>noTitle: ".$noTitle."noDesc: ".$noDesc."</p>";
	}





	function dir4search(){
		$dir="./";
		$fh = opendir($dir);
		while($entry = readdir($fh)) {
		if($entry == ".." || $entry == ".")
		  continue;
		  if(is_dir($dir . $entry))
			echo "'".$entry."/', ";
		}
		closedir($fh);
	}
?>